<template>
  <li>
    <img :src="comment.user.avatarUrl" alt="" />
    <div>
      <div class="information">
        <div class="userName">
          <p>{{ comment.user.nickname }}</p>
          <span>{{ sendTime }}</span>
        </div>
        <div class="likedCount">
          <span>{{ comment.likedCount }}</span>
          <img src="../assets/fabulous.png" alt="" />
        </div>
      </div>
      <p class="content">{{ comment.content }}</p>
    </div>
  </li>
</template>

<script>
export default {
  props: {
    comment: Object,
  },
  computed: {
    sendTime() {
      let d = new Date();
      return (
        d.getFullYear(this.comment.time) +
        "年" +
        (d.getMonth(this.comment.time) - 1) +
        "月" +
        d.getDate(this.comment.time) +
        "日"
      );
    },
  },
};
</script>

<style lang="less" scoped>
ul {
  text-align: left;
}
li {
  padding: 10px;
  display: flex;
  & > img {
    border-radius: 50%;
    margin-right: 10px;
    width: 30px;
    height: 30px;
  }
  & > div {
    display: flex;
    flex-direction: column;
    width: 50vw;
    flex: 1;

    &>p{
      font-size: 15px;
      margin-top: 10px;
    }
  }
  .information {
    display: flex;
    justify-content: space-between;

    .likedCount {
      color: #c4a6a6;
      display: flex;
      align-items: flex-start;

      img {
        width: 16px;
      }
      span {
        font-size: 14px;
        margin-right: 5px;
      }
    }
  }
  .userName {
    display: flex;
    flex-direction: column;

    p {
      font-size: 14px;
      color: #666666;
    }
    span {
      font-size: 12px;
      color: #999999;
    }
  }
  .content{
    width: 70vw;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
</style>